$(()->
  $('.del').click (e)->
    target = $(this);
    id = target.attr('data-id')
    tr = $('.item-id-' + id)
    tr.remove()
    $.ajax
      type:'DELETE',
      url:'/admin/movie/list?id='+id

  $('#douban').blur ()->
    douban = $(this)
    id = douban.val()
    if id
      $.ajax
        url: "https://api.douban.com/v2/movie/subject/" + id,
        cache: true,
        type: 'get',
        dataType: 'jsonp',
        crossDomain: true,
        jsonp: 'callback',
        success: (data)->
          $('#inputTitle').val(data.title) if data.title
          $('#inputDoctor').val(data.directors[0].name) if data.directors[0].name
          $('#inputCountry').val(data.countries[0]) if data.countries[0]
          $('#inputLanguage').val(data.Language) if data.Language
          $('#inputPoster').val(data.images.large) if data.images.large
          $('#inputYear').val(data.year) if data.year
          $('#inputSummary').val(data.summary) if data.summary
)
